#include<iostream>
using namespace std;
int Count(unsigned char v)
{
     int sum=0;
     while(v)
    {
         sum++;
         v &= v - 1;
    }
    return sum;
}

int main()
{
	unsigned char v;
	while(cin>>v)
	{
		cout<<Count(v)-2<<endl;
	}
	return 1;
}